//
//  WithdrawFundsCell.m
//  DaJiang
//
//  Created by sally on 16/10/6.
//  Copyright © 2016年 jiniu. All rights reserved.
//

#import "DateUtil.h"
#import "WithdrawFundsCell.h"

@interface WithdrawFundsCell ()

@property (weak, nonatomic) IBOutlet UILabel *topicLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *timeWidthLyt;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *priceWidthLyt;

@end

@implementation WithdrawFundsCell

- (void)awakeFromNib {
}

- (void)setCellData:(CashLogModel *)cellData {
  if (cellData.op_data.topic_name) {
    self.topicLabel.text = cellData.op_data.topic_name;
    self.nameLabel.text = cellData.op_data.user_name;
  }else{
    self.topicLabel.text = @"转出";
    self.nameLabel.text = @"我";
  }
  self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f", cellData.value];
  //给价格设置宽度，以确认topic的宽度
  self.priceWidthLyt.constant = [self.priceLabel.text sizeWithAttributes:@{NSFontAttributeName : GCustomNormalFont}].width + 2;
  self.timeLabel.text = [DateUtil getFormatTime:cellData.timestamp];
  //给时间设置宽度，以确认name的宽度
  self.timeWidthLyt.constant = [self.timeLabel.text sizeWithAttributes:@{NSFontAttributeName : GFontWithSize(GXSmallFontSize)}].width + 2;
}

@end
